package com.balance.anole.client.retail.provider;

import java.text.DecimalFormat;
import java.text.FieldPosition;

import org.eclipse.jface.viewers.ITableLabelProvider;
import org.eclipse.jface.viewers.LabelProvider;
import org.eclipse.swt.graphics.Image;

import com.balance.anole.business.to.ShopPaymentTO;

public class ShopPaymentProvider extends LabelProvider implements ITableLabelProvider{
	@Override
	public Image getColumnImage(Object element, int columnIndex) {
		return null;
	}

	@Override
	public String getColumnText(Object element, int columnIndex) {
		ShopPaymentTO shopPaymentTO = (ShopPaymentTO)element;
		switch(columnIndex){
			case 0:
				return shopPaymentTO.getPaymentMode().getCodeDesc();
			case 1:
				DecimalFormat df = new DecimalFormat("#0.00");
				return df.format(shopPaymentTO.getPaidValue(), new StringBuffer(),new FieldPosition(0)).toString();
			default :
				return "unknown " + columnIndex;
		}
	}
}
